#encoding=utf-8

import time
import urllib

import ProtocolHelper

msgid = 1
now_ts = time.time()
start = now_ts
end = start + 60*60*24*7
end = start + 60#*60*24*7
sort = 1
callid = 1#可固定为1
params = ["测试跑马灯：123456（送红包）","all", msgid, start, end, sort]    # 接口参数，顺序需对应
#params = ["测试跑马灯：123456（送红包）","all", msgid]    # 接口参数不够，顺序不对应
data = [{"m":"EXTERNAL_ADDSCROLLNOTES",#接口名
     "c":callid,
     "p":params,
     "st":now_ts}]
#玩家信息查询
params=['73ead9c4a39411e7950a5254000d335c']
params=['皇']
data = [{"m":"EXTERNAL_SEARCH_NAME",#接口名
     "c":callid,
     "p":params,
     "st":now_ts}]
# server_id = "test1"
# server_url="192.168.0.128:8106"
# server_id = "_5wan1"
# server_url="123.207.52.239:8105"
server_id = "test2"
server_url="203.195.130.75:8107"

_key = str(callid)+":"+str(int(now_ts))#可固定
url = "http://%s/%s/%s/0?%s|%s"%(server_url,"oss",server_id,_key, urllib.quote(ProtocolHelper.Encode(data, "oss")))
print("url: {}".format(url))
ret = urllib.urlopen(url).read()
print '--->',ret
result = ProtocolHelper.Decode(ret, "oss")
print(result)

